package com.example.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {
    @Bean
    FanoutExchange fanoutExchange(){
        return new FanoutExchange("fanout_test_exchange");
    }

    @Bean
    Queue queue1(){
        return new Queue("test1_fanout_queue");
    }

    @Bean
    Queue queue2(){
        return new Queue("test2_fanout_queue");
    }

    @Bean
    Binding binding1(){
        return BindingBuilder.bind(queue1()).to(fanoutExchange());
    }
    @Bean
    Binding binding2(){
        return BindingBuilder.bind(queue2()).to(fanoutExchange());
    }
}
